package com.projectmanagement.model.dao.hibernate;

import java.util.List;

import org.hibernate.criterion.Restrictions;

import com.projectmanagement.model.dao.UserDAO;
import com.projectmanagement.model.data.User;

public class UserDAOImpl extends GenericHibernateDAO<User, Long> implements
		UserDAO {

	@Override
	public User login(String username, String password) {
		List<User> users = findByCriteria(
				Restrictions.eq("username", username),
				Restrictions.eq("password", password));

		if(users.size() > 0){
			return users.get(0);
		}
		return null;
	}

}
